/* battle.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: url('https://images.unsplash.com/photo-1511512578047-dfb367046420?ixlib=rb-1.2.1&auto=format&fit=crop&w=1351&q=80') no-repeat center center fixed;
    background-size: cover;
    color: #fff;
    font-family: 'Arial', sans-serif;
    position: relative;
    overflow: hidden;
    height: 100vh;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: -1;
}

.battle-container {
    width: 100vw;
    height: 100vh;
    display: grid;
    grid-template-rows: 50% 50%;
    position: relative;
}

.battle-area {
    display: grid;
    grid-template-columns: 20% auto;
    height: 100%;
    padding: 20px;
    position: relative;
}

.enemy-area {
    background: rgba(106, 17, 203, 0.1);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.player-area {
    background: rgba(37, 117, 252, 0.1);
}

.character-section {
    flex: 1;
    display: flex;
    gap: 20px;
    padding: 10px;
    position: relative;
    justify-content: center;
}

.character-info {
    width: 150px;
    background: rgba(42, 42, 42, 0.8);
    padding: 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

.character-avatar {
    width: 100%;
    height: 42%;
    background: linear-gradient(135deg, #3a3a3a, #4a4a4a);
    border-radius: 50%;
    margin: 0 auto 15px;
    border: 3px solid #ffd700;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.character-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-stats {
    margin-bottom: 15px;
}

.character-stats p {
    font-size: 14px;
    margin: 5px 0;
    color: #fff;
}

.equipment-area {
    margin-top: 5px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.role-equipment-area {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.equipment-slot {
    width: 40px;
    height: 40px;
    background: rgba(58, 58, 58, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.role-buff-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.role-buff-slot {
    width: 20px;
    height: 20px;
    background: rgba(58, 58, 58, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.role-equipment-slot {
    width: 20px;
    height: 20px;
    background: rgba(58, 58, 58, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.equipment-slot:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3);
}

.role-buff-slot:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3); 
}

.role-equipment-slot:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.3);
}


.equipment-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.role-buff-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.role-equipment-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.battlefield {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 20px;
    min-height: 150px;
    padding: 15px 0;
}

.enemy-battlefield {
    align-self: flex-end;
}

.enemy-card-area {
    display: grid;
    grid-template-rows: 1fr auto;
    position: relative;
    margin-top: 20px;
}

.field-character {
    width: 90px;
    height: 130px;
    background: rgba(42, 42, 42, 0.8);
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
}

.field-character:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(255, 215, 0, 0.3);
    border-color: #ffd700;
}

.field-character::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(106, 17, 203, 0.3), rgba(37, 117, 252, 0.3));
    z-index: -1;
}

.field-character-image {
    position: absolute;
    width: auto;
    height: 100%;
    object-fit: cover;
    top: 0;
}

.field-character-content {
    width: 90px;
    height: auto;
    background: rgba(42, 42, 42, 0.8);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
}

.char-name {
    font-size: 13px;
    text-align: center;
    margin-bottom: 8px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.char-hp, .char-attack {
    font-size: 11px;
    text-align: center;
    margin: 3px 0;
    color: #fff;
}

.hand-area {
    flex: 1;
    display: flex;
    justify-content: center;
    gap: 15px;
    min-height: 140px;
    padding: 15px 0;
    align-items: center;
}

.enemy-card {
    width: 70px;
    height: 100px;
    background: rgba(58, 58, 58, 0.9);
    border-radius: 8px;
    position: relative;
    border: 1px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.enemy-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.card-back {
    background: linear-gradient(135deg, #2a2a2a, #3a3a3a);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.card-image {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.card-cost {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 20px;
    height: 20px;
    background: var(--mana-color, rgba(255, 215, 0, 0.8));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #000;
}

.card-name {
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    padding: 0 5px;
    color: #ffd700;
    font-weight: bold;
}

.deck-area {
    display: flex;
    gap: 20px;
    padding: 10px;
    justify-content: center;
}

.deck, .discard-pile {
    width: 70px;
    height: 100px;
    background: rgba(42, 42, 42, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.deck::after, .discard-pile::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
}

.surrender-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.surrender-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(231, 76, 60, 0.4);
}

.surrender-btn:active {
    transform: scale(0.95);
}

.next-turn-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.next-turn-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(231, 76, 60, 0.4);
}

.next-turn-btn:active {
    transform: scale(0.95);
}

.battle-info {
    position: absolute;
    top: 20px;
    right: 20px;
    color: #ffd700;
}

.battle-info p {
    font-size: 18px;
    margin: 0;
    padding: 0;
}

.battle-info span {
    font-size: 24px;
    font-weight: bold;
}


.settlement-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.3);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.settlement-content {
    background: rgba(42, 42, 42, 0.95);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    animation: popIn 0.4s ease-out;
    max-width: 500px;
    width: 90%;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.round-end-content {
    background: rgba(255, 255, 255, 0);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    animation: flowInAndOut 1s ease-in-out 1;
}

.round-end-title {
    font-size: 28px;
    margin-bottom: 25px;
    color: #e74c3c;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

@keyframes flowInAndOut {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    50% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(100%);
        opacity: 0;
    }
}

.settlement-title {
    font-size: 28px;
    margin-bottom: 25px;
    color: #ffd700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.settlement-title.victory {
    color: #2ecc71;
}

.settlement-title.defeat {
    color: #e74c3c;
}

.reward-info {
    margin-top: 25px;
    font-size: 18px;
}

.reward-info p {
    margin: 15px 0;
    color: #ffd700;
}

.reward-amount {
    font-size: 24px;
    font-weight: bold;
    color: #2ecc71;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .character-avatar {
        height: auto;
    }

    .character-info {
        width: 180px;
        padding: 10px;
    }
    
    .hand-area {
        gap: 10px;
    }
    
    .card {
        width: 60px;
        height: 90px;
    }
    
    .field-character {
        width: 80px;
        height: 120px;
    }
    
    .settlement-content {
        padding: 20px;
    }
    
    .settlement-title {
        font-size: 24px;
    }
    
    .reward-info {
        font-size: 16px;
    }
}

/* 手牌布局 */
.hand-area.fan-hand {
    position: relative;
    height: 100%;
    padding: 15px 0;
    perspective: 1200px;
    overflow: visible;
}

.hand-area.fan-hand .card {
    position: absolute;
    bottom: 0;
    top: 0;
    left: 50%;
    width: 100px;
    height: 140px;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    transform: translateX(var(--offset));
}

.player-card {
    background: rgba(58, 58, 58, 0.9);
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 悬停效果 */
.hand-area.fan-hand .player-card:hover {
    transform: translateX(var(--offset)) translateY(-50%) scale(1.3);
    z-index: 100;
    filter: drop-shadow(0 15px 25px rgba(255,215,0,0.6));
}

/* 响应式适配 */
@media (max-width: 768px) {
    .hand-area.fan-hand {
        height: 200px;
    }
    .hand-area.fan-hand .card {
        width: 80px;
        height: 110px;
    }
}